Polish English
Runaurufu "If you don't hava a plan - do not follow plan of others"

VirtualBox and shared directory

Host: Windows (tested on XP, Vista, Win 7)
Guest: Linux (tested on Ubuntu and OpenSuse)

Many people have problems with access to shared directories using default Virtual Box options (and this article is direct effect of my problems with these features). Some people try to work this around by using pen-drives or other external devices to simply transfer data from guest to host (or other way) machine, but it is not only troublesome but also VERY inefficient. Thankfully there is fstab which can help us a lot with this issue.

But first things first...

IP Address

The first and most important thing which we will need is IP address of machine with shared directory to which we want to connect. It is worth to point out that this directory does not have be located on virtualization host machine - it can be either other virtual machine or entirely different physical machine in that network.
If we decide to connect with the same computer (physical machine) on which virtualization is launched that it good to know that by default host machine's IP is 10.0.2.2. In other words in most cases you can use this address instead of Virtual Box network card.
However if that default address by any reason will not work correctly with shared folders than you should use IP address of Virtual Box cr eated card. You can acquire it by starting cmd and running "ipconfig" and in it's results find network card containing "VirtualBox" in it's name... Or you can get it by clicking on VB menus


Select "Plik"->"Global settings"

Go to "Network" tab, select network adapter and click screwdriver icon

Host IP address is located on highlighted box

Share folder in Windows

While setting shared folder properties you should remember to allow save and modification access of folder content for user whom you want use to establish connection.

Linux magic

After starting OS create new folder which will be used for mounting network resource.
mkdir /mnt/win
Now open fstab file (/etc/fstab) with root account and add line:
//192.167.56.1/Shared /mnt/win smbfs rw,umask=777,uid=LinuxUser,username=WinUser,password=WinPassword,auto 0 0
General form:
//{computer IP}/{shared resource name} {path to directory used for mounting shared resource} {file system} rw,umask=777,uid={Linux user name},username={Windows user name},password={Windows user password},auto 0 0
Be aware that Linux user used in this step will be owner of all files existing in this mounted directory

If you do not have installed smbfs than you can replace it with cifs - however you also need to enter a little different entry into your fstab file:
//192.167.56.1/Shared /mnt/win cifs file_mode=0777,dir_mode=0777,uid=LinuxUser,username=WinUser,password=WinPassword,auto 0 0

Remember to save changes in fstab file!

Last step

As a last step you need to mount resource via mount:
mount /mnt/win At that point you either mounted successfully network resource or saw info about occurred error...

Common issues

  • "mount: unknown filesystem type 'smbfs'
    Reason: Probably your system does not have installed smbfs :)
    Solution: Try use cifs instead of smbfs or install smbfs (sudo apt-get install smbfs)

2013-05-10 20:22:46
2014-10-12 17:10:49

Categories: IT related

Comments

Hi, I have a question regrading the legality of recording and posting story times on Youtube. We want to do this at our library because we have some kids who can't make it to the library for regular Story Times. Basically, I want to know whether this violates copyright because we'd be reading the whole story. We wouldn't be showing any of the patrons' faces (we'd probably still have them sign waivers just in case), but that shouldn't be the major legal issue. Thanks for the advice!
Donnie
Unfortunately it didn’t work for me; I gotmount error: peirmssion denied or not superuser and mount.cifs not installed SUID I too had this problemYou have to set the right owner for the mount pointfor example, about the command://server/share /mnt cifs rw,user,noauto,username=user,password=pass 0 0/mnt has to be owned by user:user_groupps. remember to add suid to umount.cifs too a0|a0
Abanobi

Write new comment

Author:
Email (visible only to administration):
Website: